package com.atiguigu.rabbitmq.eight;

import com.atiguigu.rabbitmq.utils.RabbitMqUtils;
import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DeliverCallback;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;

/*
* 死信队列生产者代码
* */
public class Producer {
    public static final String NORMAL_EXCHANGE= "normal_exchange";

    public static final String NORMAL_QUEUE= "normal_queue";
    public static void main(String[] args) throws IOException, TimeoutException {
        Channel channel = RabbitMqUtils.getChannel();
        //声明死信消息过期时间
        AMQP.BasicProperties properties=
                new AMQP.BasicProperties().builder().expiration("10000").build();
        for(int i=1;i<11;i++){
            String message="info"+i;
            channel.basicPublish(NORMAL_EXCHANGE,"zhangsan",null,message.getBytes("UTF-8"));
        }

    }
}
